﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAO;
using DTO;
using System.ComponentModel;

namespace BUS
{
    public class EmployeeBUS
    {
        EmployeeDAO EmployeeDao = new EmployeeDAO();

        public int InsertEmployee(EmployeeDTO employeeDto)
        {
            if (EmployeeDao.CheckExistsCode(employeeDto.EmployeeCode))
            {
                return 0;
            }

            return EmployeeDao.InsertEmployee(employeeDto);
        }

        public List<EmployeeDTO> GetEmployeeList()
        {
            return EmployeeDao.GetEmployeeList();
        }

        public bool CheckExistsCode(string code)
        {
            return EmployeeDao.CheckExistsCode(code);
        }

        public bool UpdateEmployee(EmployeeDTO empDTO)
        {
            return EmployeeDao.UpdateEmployee(empDTO);
        }

        public EmployeeDTO GetEmployeeByID(int empID)
        {
            return EmployeeDao.GetEmployeeByID(empID);
        }

        public BindingList<EmployeeDTO> GetNewBindingListEmployee()
        {
            return EmployeeDao.GetNewBindingListEmployee();
        }

        public bool DeleteEmployee(int empID)
        {
            return EmployeeDao.DeleteEmployee(empID);
        }
        public List<UsersGroupDTO> Load_UserGroup()
        {
            return EmployeeDao.Load_UserGroup();
        }

        public List<EmployeeDTO> GetEmployeeListNotHasAccount()
        {
            return EmployeeDao.GetEmployeeNotHasAccount();
        }
    }
}
